In a controller there is a code
def action1
generic_call __method__
end
def action2
generic_call __method__
end
#......
def action_n
generic_call __method__
end
private
def generic_call method_name
#..........
end
To get rid off repeating, would it be better to generate actions dynamically? Would it be more costly compared to static definition? How can I do that?
action1action2up toactionnthen I'd suggest something else has already gone wrong, and I'd wonder why you're not just using a parameter. I'd also wonder why you've eschewed semantically-meaningful actions, but that's a different issue.